package edu.lingnan.house.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import edu.lingnan.house.pojo.TbPicture;
import edu.lingnan.house.service.TbPictureService;
import edu.lingnan.house.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("lin-picture")
@CrossOrigin
public class PictureController {
    @Autowired
    private TbPictureService tbPictureService;

    @GetMapping("getPicture")
    public Result<List<TbPicture>> Picture(String houseId){
        //通过houseId查询pictures
        QueryWrapper<TbPicture> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("house_id",houseId);
        List<TbPicture> tbPicture = tbPictureService.list(queryWrapper);
        return new Result<>(200, tbPicture, "ok");
    }
}
